#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  view.py
#       Author @  Huoty
#  Create date @  2015-12-15 14:57:49
#  Description @
# *************************************************************

from flask import Blueprint, render_template
from jinja2 import TemplateNotFound
from kwsite.admin.models import *
#from kwsite import app

page = Blueprint('page', __name__, template_folder='templates')

@page.route('/', defaults={'page': 'index'})
@page.route('<page>')
def show_page(page):
    if page == "navigation":
        items = Favorites.query.getall()
        if items:
            favorites = {}
            category_se = []
            category_usual = []
            category_technology = []
            category_tool = []
            category_opensource = []
            category_material = []
            category_resources = []
            category_collection = []
            category_flink = []
            category_music = []
            category_translation = []
            category_cloudisk = []
            category_aboutme = []
            for item in items:
                if item.category == "se":
                    category_se.append()
        try:
            return render_template("%s.html" % page, dict_test = dict_test)
        except TemplateNotFound:
            abort(404)
    else:
        try:
            return render_template("%s.html" % page)
        except TemplateNotFound:
            abort(404)


# Script starts from here
